<?php
	if(isset($_REQUEST['action_mailjet'])){
		if($_REQUEST['action_mailjet'] == "desinscription"){
			$desinscription = new Mailjet_desinscription();
			if(! $desinscription->charger($_REQUEST['mailjet_email'])){
				$client = new Client();
				if($client->charger_mail($_REQUEST['mailjet_email']))
					$desinscription->client = $client->id;
						
				$desinscription->email = $_REQUEST['mailjet_email'];
				$desinscription->date = date("Y-m-d H:i:s");
				$desinscription->add();
			}
		}

		if($_REQUEST['action_mailjet'] == "desinscription_annulation"){
			$desinscription = new Mailjet_desinscription();
			$desinscription->charger_id($_REQUEST['id']);
			$desinscription->delete();
		}			

		if($_REQUEST['action_mailjet'] == "envoyer"){
			$mailjet = new Mailjet();
			$mailjet->mail($_REQUEST['id']);
		}	

	}
?>